//
//  SaveData.m
//  XferCalc
//
//  Created by Nathan Nottingham on 11/22/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "SaveData.h"

@implementation SaveData
-(id)init {
	self = [super init];
	fileSize = nil;
	unitSize = xferSpeed = nil;
	return self;
}

-(void)setNumber:(NSString *)num1 andNumber:(NSNumber *)num2 andNumber:(NSNumber *)num3 {
	[num1 retain];
	fileSize = num1;
	
	[num2 retain];
	unitSize = num2;

	[num3 retain];
	xferSpeed = num3;
}

-(NSString*)getFileSize {
	return fileSize;
}

-(int)getUnitSize {
	return unitSize.intValue;
}

-(int)getXferSpeed {
	return xferSpeed.intValue;
}

-(void)logStrings {
	NSLog(@"1:%@,2:%@,3:%@\n",fileSize,unitSize,xferSpeed);
}

- (void)encodeWithCoder:(NSCoder*)coder {
	if ([coder allowsKeyedCoding]) {
		[coder encodeObject:fileSize forKey:@"fileSize"];
		[coder encodeObject:unitSize forKey:@"unitSize"];
		[coder encodeObject:xferSpeed forKey:@"xferSpeed"];
	}
	else NSLog(@"not supported yet..");
}

- (id)initWithCoder:(NSCoder *)coder {
	if (self = [super init]) {
		if ([coder allowsKeyedCoding]) {
			xferSpeed  = [[coder decodeObjectForKey:@"xferSpeed"] retain];
			unitSize = [[coder decodeObjectForKey:@"unitSize"] retain];
			fileSize  = [[coder decodeObjectForKey:@"fileSize"] retain];
		}
		else NSLog(@"not supported yet..");
	}
	
	return self;
}

@end
